<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>项目执行文件管理</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <link type="text/css" rel="stylesheet" href="/lib/budget/styles.css"/>
    <link type="text/css" rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>

    <script type="text/javascript" charset="utf-8" src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/pagination/js/jquery.pagination.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/base/tablePage.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/layer/layer.js?20201106"></script>
    <script type="text/javascript" src="/js/base/base.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            width: 100%;
           /* padding: 0 3%;*/
        }
        table{
            width:100%;
            border-collapse: collapse;
            margin-left: 7px;
            table-layout: fixed;
        }
        .minHeight{
            min-height: 140px;
        }
        th,td{
            width:30%;
            padding: 0 5px;
           /* border: 1px solid #666666;*/
            height: 40px;
            font-size: 13px;
            color: #333;
            line-height: 40px;
            /*溢出隐藏并显示...*/
            word-break: keep-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-align: center;


        }

        th{
           /* background-color: #00ccff;*/
            color:#2F5C8F;
        }
        .th1,.th5{
            width: 61px;
        }
        .th2{
            width: 117px;
        }
        #add{
            font-size: 14px;
            background-color: #2b7fe0;
            padding: 4px 18px;
            border-radius: 3px;
            color: #fff;
            cursor:pointer;
        }
        #clear{
            font-size: 14px;
            background-color: #2b7fe0;
            padding: 4px 18px;
            border-radius: 3px;
            color: #fff;
            cursor:pointer;
        }
        .th3{
            width: 125px;
        }
        .th4{
            width: 88px;
        }

        .th6{
            width: 70px;
        }
        .th7,.th8,.th9{
            width: 82px;
        }

        .th10{
            width: 94px;
        }
        .th11{
            width: 103px;
        }
        .th12{
            width: 82px;
        }
        .th13{
            width:  143px;
        }
        .th14{
            width: 93px;
        }
        .p1{
            float: left;
            margin-bottom: 0;
            height: 30px;
            padding-left: 10px;
            font-size: 20px;
            line-height: 30px;
        }
        .p2{
            float: right;
            height: 40px;
            margin-top: 4px;
            margin-right: 25px;
        }
        .clearfix:after {
            display: table;
            content: " ";
            clear: both;
        }
        .M-box3 .active{
            margin: 0px 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color:#fff;
            text-align:center;
            display: inline-block;
        }
        .M-box3 a{
            margin: 0 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            font-size: 12px;
            display: inline-block;
            text-align:center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #333;
            text-decoration: none;
        }
        .jump-ipt {
            width: 38px;
            height: 38px;
            line-height: 38px;
            text-align: center;
            padding: 0;
        }
        .M-box3 a:hover {
            background: #2b7fe0;
        }
        .clearfix{
            border-bottom:1px solid #9e9e9e;
            margin-bottom: 16px;
            height:36px;
        }
        .p2 span{
            font-size: 14px;
            background-color: #2b7fe0;
            padding: 4px 18px;
            border-radius: 3px;
            color: #fff;
            cursor: pointer;
        }
        .bspan{
            font-size: 14px;
            background-color: #2b7fe0;
            padding: 4px 18px;
            border-radius: 3px;
            color: #fff;
            cursor: pointer;
        }

        .main{
           /* margin-right: 1%;*/
            margin-top: 1%;
        }
        .nav-r{
            font-size: 20px;
            color: #FF0000;
            margin-left: 535px;
        }


        .biginput{
            width: 40%;
            height: 32px;
            font-size: 13px;
        }
        .foot{
            font-size: 14pt;
            /* margin-top: 58px; */
            width: 100%;
            padding: 5%;
        }
        .foot p{
            /*margin: 20px 0; */
            border-bottom: 1px solid #000;
            height: 40px;
            /* padding-left: 8px; */
        }

        /*.save span{*/
        /*padding: 6px 54px;*/
        /*font-size: 20px;*/
        /*background-color: #008cffd9;*/
        /*border-radius: 5px;*/
        /*margin-left: 162px;*/
        /*color: #fff;*/
        /*cursor:pointer;*/
        /*}*/

        tr:hover{
            background: #dedede;
            cursor:pointer;
        }
        a{
            text-decoration: none;
        }
        .dr,.dc,.new,.quanx{
            cursor:pointer;
        }
        .dr:hover,.dc:hover,.new:hover,.quanx:hover,.bspan:hover{
            background-color:#0e6bb7;
            color: #fff;
            cursor:pointer;
        }
        /*.quanx,.foot{*/
        /*display: none;*/
        /*}*/
        ul,li{
            list-style: none;
        }
        li{
            margin: 25px 0;
        }
        .del:hover{
            color: red;
        }
        .bianji:hover,.mingxi:hover{
            color: #0d3ef3;
        }
        .td_title1{
            width: 40%;
            height:32px;
        }
        .ml8{
            margin-left:8px;
        }

        input[type="file"]{

            margin-left: 8px;
        }
        .importTable{
            margin:60px auto;
        }

        #model{
            padding-left:8px;
        }





        /*分页样式*/
        .M-box3{
            margin-top: 30px;
            position: fixed;
            right: 60px;
            bottom:10px;
            text-align: center;
        }
        input[type="text"]{
            position: relative;
            margin: 0;
            padding-left: 10px;
            box-sizing: border-box;
            border: 1px solid rgb(221, 221, 221);
            border-image: initial;
            border-radius: 4px;
        }

        .jump-ipt{
            width: 38px;
            height: 38px;
            line-height: 38px;
        }
        #uploadTable tr:nth-child(2n+1) {
            background-color: rgb(246, 247, 249);
        }
        #uploadTable tr:nth-child(2n) {
            background-color: rgb(255, 255, 255);
        }
        #uploadTable tr {
            border-width: 1px;
            border-style: solid;
            border-color: rgb(192, 192, 192);
            border-image: initial;
        }
        #uploadTable tr:hover{
            background-color:#d3e6f9;
        }
        .div_Img{
            float: left;
            margin-left: 35px;
        }
        .bianji,.del{
            color:rgb(43, 127, 224)
        }
    </style>
</head>
<body>
<div class="main">
    <div class="clearfix">
        <div class="div_Img">
            <img src="/img/xmgl.png" style="vertical-align: middle;" alt="菜单主分类设置">
        </div>
        <p class="p1">预算项目管理</p>
        <div class="p2"><span class="new"><img style="margin-right: 3px;margin-left: -8px;margin-bottom: -2px;" src="../../img/newfanhui.png" alt="">返回</span></div>
    </div>
    <div id="u268" style="margin:0 30px">
        <div class="minHeight">
            <table id="uploadTable" style="width:100%;table-layout: fixed">
                <thead>
                <tr>
                    <th class="th1">项目编号</th>
                    <th class="th2">上级项目</th>
                    <th class="th3">项目名称</th>
                    <th class="th4">指标分类</th>
                    <th class="th5">额度号</th>
                    <th class="th6">项目金额</th>
                    <th class="th7">项目负责人</th>
                    <th class="th8">所属部门</th>
                    <th class="th9">项目执行人</th>
                    <th class="th13">操作</th>
                    <%--<th class="th14">日志</th>--%>
                </tr>
                </thead>
                <tbody>

                </tbody>

            </table>
        </div>
    </div>
    <div id="dbgz_page" class="M-box3 fr" style="margin-top: 29px;">

    </div>

</div>
</body>
<script>
    $('.new').click(function(){
        location.href="/budget/budgetItemManage";
    })
    function undefindData(data) {
        if(data == undefined){
            return '';
        }else{
            return data;
        }
    }
    var ajaxPage={
        data:{
            page:1,//当前处于第几页
            pageSize:5,//一页显示几条
            useFlag:true
        },
        page:function () {
            var me=this;
          //  console.log(me)
            $.post('/budget/selAllBudget?delFlag=true',me.data,function (json) {
                var str='';
                var arr=json.obj;
                if(arr.length == 0){
                    var width = $(window).width()-60+'px';
                    str = '<li class="no_notice" style="background:#fff;text-align: center;padding: 27px 0px;border: 1px solid #c0c0c0;border-top: none;width: '+ width +';margin: 0;"><img style="margin-bottom: 20px;" src="/img/main_img/shouyekong.png" alt=""><h2 style="text-align: center;color: #666;font-size: 16px">暂无数据</h2></li>';
                }else{
                    for(var i=0;i<arr.length;i++){
                        var item = arr[i]
                        str+= '<tr budgetId="'+item.budgetId+'" indata="'+item.inputTime+'">'+
                            '<td title='+undefindData(item.budgetItemNo)+'>'+undefindData(item.budgetItemNo)+'</td>'+
                            '<td title="'+undefindData(item.priveItem)+'">'+undefindData(item.priveItem)+'</td>'+
                            '<td title="'+undefindData(item.budgetItemName)+'">'+undefindData(item.budgetItemName)+'</td>'+
                            '<td title="'+undefindData(item.quotaClassify)+'">'+undefindData(item.quotaClassify)+'</td>'+
                            '<td title="'+undefindData(item.lineNo)+'">'+undefindData(item.lineNo)+'</td>'+
                            '<td title="'+undefindData(item.itemMoney)+'">'+undefindData(item.itemMoney)+'</td>'+
                            '<td title="'+undefindData(item.itemManager)+'">'+undefindData(item.itemManager)+'</td>'+
                            '<td title="'+undefindData(item.deptName)+'">'+undefindData(item.deptName)+'</td>'+
                            '<td title="'+undefindData(item.itemExecuter)+'">'+undefindData(item.itemExecuter)+'</td>'+
                            '<td><span style="color:rgb(43, 127, 224);cursor:pointer"  class="bianji">撤回</span> <span style="color:rgb(43, 127, 224);cursor:pointer"  class="del" >删除 </span>'+
                            '</tr>'
                    }
                }

                $('#u268 table tbody').html(str)
                me.pageTwo(json.totleNum,me.data.pageSize,me.data.page)
            },'json')
        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                prevContent:'上一页',
                nextContent:'下一页',
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPage.page();
    $('table').on('click','.del',function(){
        var budgetId=$(this).parent().parent().attr('budgetId')
        var budgetItemName=$(this).parent().parent().children().eq(3).html()
        var writerName = $(this).parent().parent().attr('indata')
        layer.open({
            type: 1,
            title: ['提示','background-color:#2e8ded;color:#fff'],
            content:'<div style="text-align: center;margin-top: 18px;">确认删除吗？</div>',
            area: ['200px', '160px'],
            btn: ['确认','取消'],
            yes:function(index){
                $.ajax({
                    url:'/budget/delBudgetItemById?type=1',
                    type:'post',
                    data:{
                        'budgetId':budgetId,
                        'budgetItemName':budgetItemName,
                        'inputTime':writerName
                    },
                    dataType:'json',
                    success:function(res){
                        layer.close(index)
                        if(res){
                            layer.msg("删除成功",{
                                icon: 1,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href="/budget/newdel"
                            })
                        }else {
                            layer.msg("删除失败",{
                                icon: 2,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href="/budget/budgetItemManage"
                            })
                        }
                    }
                })
            },
            btn2: function (index) {
                layer.close(index)
            },
            btnAlign:'c',

        })
    });
    $('table').on('click','.bianji',function(){
        var budgetId=$(this).parent().parent().attr('budgetId')
        var budgetItemName=$(this).parent().parent().children().eq(3).html()
        var writerName = $(this).parent().parent().attr('indata')
        layer.open({
            type: 1,
            title: ['提示','background-color:#2e8ded;color:#fff'],
            content:'<div style="text-align: center;margin-top: 18px;">确认撤回吗？</div>',
            area: ['200px', '160px'],
            btn: ['确认','取消'],
            yes:function(index){
             //   console.log(1)
                $.ajax({
                    url:'/budget/delBudgetItemById?type=2',
                    type:'post',
                    dataType:'json',
                    data:{
                        'budgetId':budgetId,
                        'budgetItemName':budgetItemName,
                        'inputTime':writerName
                    },
                    success:function(res){
                        layer.close(index)
                        if(res){
                            layer.msg("撤回成功",{
                                icon: 1,
                                time: 1500 //2秒关闭（如果不配置，默认是3秒）
                            },function(){
                                location.href="/budget/newdel"
                            })
                        }
                    }
                })
            },
            btn2: function (index) {
                layer.close(index)
            },
            btnAlign:'c',

        })
    });
</script>
</html>
